package model;

public class Account {
	private int id;
	private boolean lock;
	private String name;
	private String author;
	private String pass;
	private String power;
	private String lastLoggin;

	public Account(int id, boolean lock, String name, String author,
			String pass, String power, String lastLoggin) {
		this.id = id;
		this.lock = lock;
		this.name = name;
		this.author = author;
		this.pass = pass;
		this.power = power;
		this.lastLoggin = lastLoggin;
	}

	public Account(String name, String author, String power) {
		this.name = name;
		this.author = author;
		this.power = power;
	}

	public Account(int id, String name, String power) {
		this.id = id;
		this.name = name;
		this.power = power;
	}

	// use in loggin controller
	public Account(String name, String power) {
		this.name = name;
		this.power = power;
	}

	public boolean isLock() {
		return lock;
	}

	public String getName() {
		return name;
	}

	public String getAuthor() {
		return author;
	}

	public String getPass() {
		return pass;
	}

	public String getPower() {
		return power;
	}

	public String getLastLoggin() {
		return lastLoggin;
	}

	public void setLock(boolean lock) {
		this.lock = lock;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setAuthor(String author) {
		this.author = author;
	}

	public void setPass(String pass) {
		this.pass = pass;
	}

	public void setPower(String power) {
		this.power = power;
	}

	public void setLastLoggin(String lastLoggin) {
		this.lastLoggin = lastLoggin;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Account) {
			Account that = (Account) obj;
			if (this.name.equals(that.name) && this.author.equals(that.author)
					&& this.power.equals(that.power))
				return true;
		}
		return false;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public boolean getLock() {
		return this.lock;
	}

	public boolean isUser() {
		return power.equalsIgnoreCase("user");
	}

}
